﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

using System.Windows.Data;

namespace ESC.Designer.Resources
{
    class CutLotNoNewPrintQTYConvert : IMultiValueConverter
    {
        public object Convert(object[] value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                decimal value1 = decimal.Parse(value[0].ToString());
                if (value[1] == null)
                {
                    return value1.ToString("0.###");
                }else
                {
                    decimal value2 = decimal.Parse(value[1].ToString());
                    return (value1 * value2).ToString("0.###");
                }
            }
            catch
            {
                return "";
            }
            return "";
        }
        

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
